package com.gopay.bis.icbc.expay.impl;

import com.gopay.bis.icbc.expay.operation.IcbcExpayHelper;
import com.gopay.common.domain.bank.BaseMessage;
import com.gopay.common.domain.bank.icbc.expay.pay.res.IcbcExpayCmsRes;
import com.gopay.common.domain.bank.icbc.expay.prepay.res.IcbcPreExpayCmsRes;
import com.gopay.common.domain.bank.icbc.expay.query.res.IcbcQueryExpayCmsRes;
import com.gopay.common.exception.GopayException;
import com.gopay.remote.bank.businesses.ExPayService;

/** 
 * 工行快捷 bis-bank实现类
 * @ClassName: IcbcExPayBankServiceImpl 
 * @author w_jiqing 
 * @date 2017年6月27日 上午10:58:39  
 */ 
public class IcbcExPayBankServiceImpl implements ExPayService{
    
    private IcbcExpayHelper icbcExpayHelper;

   /**
    * 工行快捷预支付
    */
    public Object sendSms(BaseMessage baseMsg) throws GopayException {
        String responseBody =icbcExpayHelper.sendSendSmsReq(baseMsg);
        IcbcPreExpayCmsRes res = new IcbcPreExpayCmsRes();
        res = (IcbcPreExpayCmsRes) icbcExpayHelper.parseSendSms(responseBody);                        
        return res;
    }

    /**
     * 工行快捷支付
     */
    public Object payment(BaseMessage baseMsg) throws GopayException {
        String responseBody = icbcExpayHelper.sendPaymentReq(baseMsg);
        IcbcExpayCmsRes res = new IcbcExpayCmsRes();
        res = (IcbcExpayCmsRes) icbcExpayHelper.parsePayment(responseBody);
        res.setBankRetCode(res.getEb().getPub().getRetCode()); //返回码
        res.setReturnInfo(res.getEb().getPub().getRetMsg()); //返回描述
        return res;
    }
    
    /**
     * 工行快捷订单查询
     */
    public Object queryOrder(BaseMessage baseMsg) throws GopayException {
        String responseBody = icbcExpayHelper.sendQueryOrderReq(baseMsg);
        IcbcQueryExpayCmsRes res = new IcbcQueryExpayCmsRes();
        res = (IcbcQueryExpayCmsRes) icbcExpayHelper.parseQuery(responseBody);
        res.setBankRetCode(res.getEb().getPub().getRetCode());
        return res;
    }
    
    @Override
    public Object signQuery(BaseMessage baseMsg) throws GopayException {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Object sign(BaseMessage baseMsg) throws GopayException {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Object verify(BaseMessage baseMsg) throws GopayException {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Object treatyQuery(BaseMessage baseMsg) throws GopayException {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Object cancel(BaseMessage baseMsg) throws GopayException {
        // TODO Auto-generated method stub
        return null;
    }
    

    @Override
    public Object refund(BaseMessage baseMsg) throws GopayException {
        // TODO Auto-generated method stub
        return null;
    }

    

    @Override
    public Object certification(BaseMessage baseMsg) throws GopayException {
        // TODO Auto-generated method stub
        return null;
    }

    

    @Override
    public Object checkSms(BaseMessage baseMsg) throws GopayException {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Object queryCvn(BaseMessage baseMsg) throws GopayException {
        // TODO Auto-generated method stub
        return null;
    }

    public IcbcExpayHelper getIcbcExpayHelper() {
        return icbcExpayHelper;
    }

    public void setIcbcExpayHelper(IcbcExpayHelper icbcExpayHelper) {
        this.icbcExpayHelper = icbcExpayHelper;
    }

}
